When an image or scene is captured on a camera or provided on some other electronic device or computer as a digital image, it can be desirable to modify the image in ways that require the device to first segment the foreground of the image from the background. For example, a user may want to change the background in the image for entertainment reasons, practical reasons such as to replace the background of a person speaking in a video conference to provide a background more appropriate or less distracting for business purposes, or artistic reasons. The background-foreground segmentation also may be used for computer vision, object recognition and augmentation, medical imaging, video coding efficiency, and others.
A number of segmentation techniques divide an image into rough segments, such as background and foreground, and then use an algorithm specifically aimed at refining the border region between the segments. These border-refining algorithms, however, are often inaccurate by placing portions that should be part of a background into a foreground instead, and vice-versa. This especially occurs when the background and foreground have the same colors or when a color pattern has strong color differences and/or complex patterns that are mistakenly and undesirably split into different segments.